package settings_api

import (
	"github.com/gin-gonic/gin"
	"gvb_server/global"
	"gvb_server/models/result"
)

type SettingsUrl struct {
	Name string `uri:"name"`
}

// SettingsInfoView显示某一项的配置信息
func (SettingsApi) SettingsInfoView(c *gin.Context) {

	var cr SettingsUrl
	err := c.ShouldBindUri(&cr)
	if err != nil {
		result.FailWithCode(result.ArgumentError, c)
		return
	}
	switch cr.Name {
	case "site":
		result.OkWithData(global.Config.SiteInfo, c)
	case "email":
		result.OkWithData(global.Config.Email, c)
	case "qq":
		result.OkWithData(global.Config.QQ, c)
	case "qiniu":
		result.OkWithData(global.Config.QiNiu, c)
	case "jwt":
		result.OkWithData(global.Config.JWT, c)
	default:
		result.FailWithMessage("没有对应的配置信息", c)
	}
}
